#!/usr/bin/python
import re

from scrapy.cmdline import execute
if __name__ == '__main__':
    url = 'http://jingzhi.funds.hexun.com/DataBase/jzzs.aspx?fundcode=000867&startdate=2015-01-01&enddate=2017-03-31'
    regex = ur"fundcode=\d+"
    match = re.search(regex, url)
    if match:
        result = match.group(0)
        fund_codes = result.split("=")
        fname_fund_code = fund_codes[1]
        print (fund_codes)
    else:
        result = ""

    print fname_fund_code + ".txt"